import request from '@/utils/request'

// 创建病虫害知识库
export function createLibrary(data) {
  return request({
    url: '/pests/library/create',
    method: 'post',
    data: data
  })
}

// 更新病虫害知识库
export function updateLibrary(data) {
  return request({
    url: '/pests/library/update',
    method: 'put',
    data: data
  })
}

// 删除病虫害知识库
export function deleteLibrary(id) {
  return request({
    url: '/pests/library/delete?id=' + id,
    method: 'delete'
  })
}

// 获得病虫害知识库
export function getLibrary(id) {
  return request({
    url: '/pests/library/get?id=' + id,
    method: 'get'
  })
}

// 获得病虫害知识库分页
export function getLibraryPage(query) {
  return request({
    url: '/pests/library/page',
    method: 'get',
    params: query
  })
}

// 导出病虫害知识库 Excel
export function exportLibraryExcel(query) {
  return request({
    url: '/pests/library/export-excel',
    method: 'get',
    params: query,
    responseType: 'blob'
  })
}
